package com.up.cloudfeiyibackend.mapper;

import com.up.cloudfeiyibackend.entity.Inheritor;
import com.up.cloudfeiyibackend.entity.InheritorApplication;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface InheritorMapper {
    /**
     * 检查用户是否已经申请
     *
     * @param userId
     * @param itemId
     * @return
     */
    int checkUserApplied(@Param("userId") Long userId, @Param("itemId") Long itemId);

    /**
     * 插入申请记录
     *
     * @param inheritorApplication
     */
    void insertApplication(InheritorApplication inheritorApplication);

    /**
     * 获取用户申请列表
     *
     * @param userId
     * @return
     */
    List<InheritorApplication> getApplicationsByUserId(Long userId);


    /**
     * 获取我的传承人信息
     *
     * @param userId
     * @return
     */
    Inheritor getMyInheritor(Long userId);
}
